package com.kaigejava.ms.linkedlist;


/**
 * MST:
 * 单链表相关的
 */
public class LinkedListLengthDemo {

    public static void main(String[] args) {
        MsLinkedList linkedList = new MsLinkedList();
        MsNode node = new MsNode(1,"张三","逍遥门");
        MsNode node2 = new MsNode(2,"李四","五月门");
        MsNode node3 = new MsNode(4,"李s四","五月f门");
        linkedList.add(node);
        linkedList.add(node2);
        linkedList.add(node3);
        //求单链表中有效节点个数
       /* System.out.printf("链表的有效数据个数为: %d",linkedList.getLength(linkedList.hearNode));
        System.out.println();

        System.out.println("获取链表中倒数第1个数据为: "+linkedList.findLastIndexNode(linkedList.hearNode,1));*/

        System.out.println("反转后的链表为:");
        linkedList.reversetList(linkedList.hearNode);
        MsNode curr = linkedList.hearNode.nextNode;
        while (null != curr){
            System.out.println(curr.toString());
            curr = curr.nextNode;
        }
        System.out.println("使用栈结构反转后的链表为:");
        linkedList.reverwithStack(linkedList.hearNode);

        System.out.println("===============合并===========================");
    }
}
